package com.bruan.d1_io;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class FileWriterTest1 {
    public static void main(String[] args) {
        try(Writer wirter = new FileWriter("file-io-app\\bruan.txt",true);) {
            //写字符
            wirter.write('a');
            wirter.write(2);
            wirter.write(1);
            wirter.write("\r\n");
            //写字符串
            wirter.write("我爱你中国abc");
            wirter.write("我爱你中国abc",0,5);
            wirter.write("\r\n");

            //写字符数组
            char[] buffer = {'h','e','l','l'};
            wirter.write(buffer);
            wirter.write("\r\n");
            System.out.println("写入完成！");

        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
